
Vue.component('deal-select', {
    template: `
        <el-select v-model="svalue" :size="size" :disabled="disabled" filterable clearable :placeholder="placeholder">
            <i slot="prefix" class="el-input__icon el-icon-notebook-2" />
            <el-option
                v-for="item in dealList"
                :key="item.id"
                :label="item.dealName"
                :value="item.id"
            />
        </el-select>
    `,
    props: {
        value: {
            type: String,
            default: ''
        },
        // 项目状态
        dealStatus: {
            type: String,
            default: () => ''
        },
        size: {
            type: String,
            default: () => ''
        },
        // 项目类型
        dealType: {
            type: String,
            default: () => ''
        },
        // 投资主体ID- 如不为空则只查询该投资主体投资过的基金
        investmentId: {
            type: String,
            default: () => ''
        },
        clearable: {
            type: Boolean,
            default: true
        },
        placeholder: {
            type: String,
            default: ''
        },
        // 是否禁用
        disabled: {
            type: Boolean,
            default: false
        }
    },
    data() {
        return {
            svalue: this.value,
            dealList: []
        }
    },
    watch: {
        value(newVal) {
            this.svalue = newVal
        },
        svalue(newVal, oldVal) {
            if (newVal !== oldVal) {
                this.$emit('input', this.svalue)
                this.$emit('change', this.svalue)
            }
        }
    },
    created() {
        var queryParams = {}
        queryParams.dealType = this.dealType
        queryParams.dealStatus = this.dealStatus
        queryParams.scope = this.scope
        queryParams.investmentId = this.investmentId
    },
    methods: {
    }
})
